package org.neuedu.chapter07_0624.practice01;

public class Players {
    private static int sum;

    private Players() {
        sum++;
    }

    public static Players create() {
        if (sum < 11) {
            System.out.println("创建了一个对象");
            return new Players();
        }
        System.out.println("对不起，已经创建11个对象了");
        return null;
    }

    public static void main(String[] args) {
        for (int i = 0; i < 20; i++) {
            Players players = Players.create();
        }
    }
}
